

//TODO a(36)
function a36(module, exports, a) {
    var i = a(23), s = a(3), r = a(2), n = a(21), o = function (e) {
        this.baseVideo = e
    };
    s.extend(o, i);
    var l = {
        init: function () {
            this.playerData = this.manager.playerData, this.baseVideo.setPreload(this.playerData.config.isPreload), r.iPhone && (r.weixin || r.qq) && this.baseVideo.setPlayInLine(), this.sendCVEvent = !1, this.src = "", this.p2pVideo = new window.CdeMediaPlayer(null, this.baseVideo.video, null), this.addVideoEvent(), this.manager.listener.on(n.PLAY_STATE, this.onPlayStateChange, this), this.errMsg = "调用p2p接口出错"
        }, onPlayStateChange: function (e, t) {
            "init" != t && "changeDefi" != t || (this.sendCVEvent = !1)
        }, addVideoEvent: function () {
            this.p2pVideo.onvideosrc = s.bind(function () {
                this.manager.log.pushLog("p2p_videosrc"), this.manager.evt.trigger("vjs_loadstart")
            }, this), this.p2pVideo.ongslbcomplete = s.bind(function () {
                this.manager.log.pushLog("p2p_gslbcomplete"), this.manager.pingback.sendPlayAction("gslb", {
                    ut: 0,
                    ry: 0
                })
            }, this), this.p2pVideo.onprepared = s.bind(function () {
                this.manager.log.pushLog("p2p_prepared"), this.gdur = this.getDuration(), "none" == this.manager.playerData.tryLookType && (this.manager.log.pushLog("vjs_durationChange video====" + this.gdur), this.manager.evt.trigger("vjs_durationChange", this.gdur)), this.playerData.videoFlag.preparePlay || this.playerData.videoFlag.startPlay || (this.manager.log.pushLog("vjs_preparPlay"), this.playerData.videoFlag.preparePlay = !0, this.manager.evt.trigger("vjs_preparPlay"))
            }, this), this.p2pVideo.onplay = s.bind(function () {
                this.manager.log.pushLog("p2p_play"), this.playerData.videoFlag.startPlay || (this.playerData.videoFlag.startPlay = !0, this.manager.log.pushLog("vjs_startPlay"), this.manager.evt.trigger("vjs_startPlay")), this.manager.evt.trigger("vjs_play")
            }, this), this.p2pVideo.onpause = s.bind(function () {
                var e = this.manager.listener.get(n.PLAY_STATE);
                "ended" != e && "stop" != e && (this.manager.log.pushLog("p2p_pause"), this.manager.evt.trigger("vjs_pause"))
            }, this), this.p2pVideo.ontimeupdate = s.bind(function () {
                !this.sendCVEvent && this.getCurrentTime().toFixed(1) > .2 && (this.sendCVEvent = !0, this.manager.log.pushLog("vjs_sendCV"), this.manager.evt.trigger("vjs_sendCV")), this.manager.evt.trigger("vjs_timeupdate")
            }, this), this.p2pVideo.onbufferstart = s.bind(function () {
                this.manager.log.pushLog("p2p_bufferstart"), this.manager.evt.trigger("vjs_p2pBufferstart")
            }, this), this.p2pVideo.onbufferend = s.bind(function () {
                this.manager.log.pushLog("p2p_bufferend"), this.manager.evt.trigger("vjs_p2pBufferend")
            }, this), this.p2pVideo.oncomplete = s.bind(function () {
                this.manager.log.pushLog("p2p_complete"), this.manager.evt.trigger("vjs_ended")
            }, this), this.p2pVideo.onerror = s.bind(function (e, t) {
                if ("30404" == e) this.manager.evt.trigger("vjs_cancellation"); else {
                    var a = this.manager.pingback.getUUID();
                    this.manager.log.pushLog("p2p_error: uuid:" + a + "===errorCode:" + e + "===" + t);
                    try {
                        this.manager.log.pushLog(window.CdeMediaHelper.getCDELog())
                    } catch (i) {
                    }
                    this.release(), this.manager.evt.trigger("vjs_p2pError")
                }
            }, this)
        }, setSrc: function (e) {
            this.playerData.videoFlag.preparePlay = !1, this.playerData.videoFlag.startPlay = !1, this.src = e, this.release();
            try {
                this.manager.log.pushLog("call p2pSetSrc: " + e), this.p2pVideo.setSource(e)
            } catch (t) {
                this.manager.log.pushLog("call p2pSetSrc Error:"), this.p2pVideo.onerror("", "")
            }
        }, getSrc: function () {
            return this.src
        }, play: function () {
            try {
                this.manager.log.pushLog("call p2pPlay"), this.p2pVideo.play()
            } catch (e) {
                this.manager.log.pushLog("call p2pPlay Error:" + e.toString()), this.p2pVideo.onerror("", this.errMsg)
            }
        }, replay: function () {
            try {
                this.manager.log.pushLog("call p2pRePlay"), this.p2pVideo.replay()
            } catch (e) {
                this.manager.log.pushLog("call p2pRePlay Error:" + e.toString()), this.p2pVideo.onerror("", this.errMsg)
            }
        }, pause: function () {
            try {
                this.manager.log.pushLog("call p2pPause"), this.p2pVideo.pause()
            } catch (e) {
                this.manager.log.pushLog("call p2pPause Error:" + e.toString()), this.p2pVideo.onerror("", this.errMsg)
            }
        }, seek: function (e) {
            if (e = Math.max(e, 1), e = Math.min(e, this.playerData.vinfo.gdur - 5), e = Math.round(e), Math.abs(e - this.getCurrentTime()) <= 1)return void this.play();
            try {
                this.manager.log.pushLog("call p2pSeek: " + e), this.p2pVideo.seek(e)
            } catch (t) {
                this.manager.log.pushLog("call p2pSeek Error:" + t.toString()), this.p2pVideo.onerror("", this.errMsg)
            }
        }, getCurrentTime: function () {
            try {
                var e = this.p2pVideo.getCurrentPosition();
                return e
            } catch (t) {
                return this.manager.log.pushLog("call p2pGetCurTime Error:" + t.toString()), this.p2pVideo.onerror("", this.errMsg), 0
            }
        }, getBuffered: function () {
            try {
                var e = this.p2pVideo.getCurrentBuffered();
                return Math.max(e, 0)
            } catch (t) {
                return this.manager.log.pushLog("call p2pGetBufferTime Error:" + t.toString()), this.p2pVideo.onerror("", this.errMsg), 0
            }
        }, getDuration: function () {
            try {
                var e = this.p2pVideo.getDuration();
                return this.manager.log.pushLog("call p2pGetDuration: " + e), e
            } catch (t) {
                return this.manager.log.pushLog("call p2pGetDuration Error:" + t.toString()), this.p2pVideo.onerror("", this.errMsg), 0
            }
        }, release: function () {
            try {
                this.manager.log.pushLog("call p2pRelease"), this.p2pVideo.release()
            } catch (e) {
                this.manager.log.pushLog("call p2pRelease Error:" + e.toString())
            }
        }, changeFullScreen: function (e) {
            this.baseVideo.changeFullScreen(e)
        }
    };
    s.merge(o.prototype, l), module.exports = o
}
